<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var number = 20
        // 模板字符串可以解析变量 需要解析变量时 使用固定格式${变量名称}
        console.log(`number = ${number}`)



        var str = '<table border="1">';
        for (var i = 1; i <= 9; i++) {
            str += '<tr>'
            // 循环产生9个td
            for (var j = 1; j <= i; j++) {
                // str += `<td>${j} * ${i} = ${i*j}</td>`;
                str += '<td>' + i + ' * ' + j + ' = ' + i * j + '</td>'
            }
            str += '</tr>';
        }

        str += '</table>';

        document.write(str);
    </script>
</body>

</html>